import { Elysia } from 'elysia';
import {
  login,
  register,
  getCurrentUser,
  changePassword,
  refreshToken,
  logout
} from '../controllers/authController';
import { authMiddleware } from '../middleware/auth';

export const authRoutes = new Elysia({ prefix: '/auth' })
  // 公开路由
  .post('/login', login)
  .post('/register', register)
  .post('/refresh', refreshToken)
  
  // 需要认证的路由
  .use(authMiddleware())
  .get('/me', getCurrentUser)
  .post('/logout', logout)
  .post('/change-password', changePassword);